package com.wom.blockfeatures;

import java.util.Random;

import com.wom.blocks.AbstractBlock;

public class BreakableBlock {

	private int health;
	public boolean isDead;
	private int hardness;


	public BreakableBlock(int health,int hardness){
		setHealth(health);
		setHardness(hardness);
	}

	public static void getClassType(AbstractBlock b){

	}

	/**
	 * @return the health
	 */
	public int getHealth() {
		return health;
	}


	/**
	 * @param health the health to set
	 */
	public void setHealth(int health) {
		this.health = health;
	}


	/**
	 * @return the hardness
	 */
	public int getHardness() {
		return hardness;
	}


	/**
	 * @param hardness the hardness to set
	 */
	public void setHardness(int hardness) {
		this.hardness = hardness;
	}

	public void causeDamage(int d){

		if(health<=0){
			isDead=true;
		}else{
			health=health-(d/hardness);
			
		}

	}

	public int[][] createVisualDamage(){
		Random r=new Random();
		r.nextInt(getHealth());

		int[][] d=new int[20][20];


		for(int x=0;x<20;x++){

			for(int y=0;y<20;y++){

				if(r.nextInt(10)>4){
					d[x][y]=1;
				}else
					d[x][y]=0;
				
			}
		}
		return d;
	}


}
